<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create a new XSLT processor</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-backend-version.html">xslt_backend_version</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.xslt-errno.html">xslt_errno</a></div>
 <div class="up"><a href="ref.xslt.html">XSLT (PHP 4) 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.xslt-create" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xslt_create</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.3)</p><p class="refpurpose"><span class="refname">xslt_create</span> &mdash; <span class="dc-title">Create a new XSLT processor</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.xslt-create-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>xslt_create</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Create and return a new XSLT processor resource for manipulation by the
   other XSLT functions.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xslt-create-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an <acronym title="eXtensible Stylesheet Language Transformations">XSLT</acronym> processor link identifier on success, or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.xslt-create-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5429">
    <p><strong>Example #1 <span class="function"><strong>xslt_create()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">xml2html</span><span style="color: #007700">(</span><span style="color: #0000BB">$xmldata</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$xsl</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;$xmldata&nbsp;-&gt;&nbsp;your&nbsp;XML&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;$xsl&nbsp;-&gt;&nbsp;XSLT&nbsp;file&nbsp;*/<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$path&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'include'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$arguments&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'/_xml'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$xmldata</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$xsltproc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xslt_create</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">xslt_set_encoding</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'ISO-8859-1'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$html&nbsp;</span><span style="color: #007700">=<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">xslt_process</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'arg:/_xml'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$path</span><span style="color: #DD0000">/</span><span style="color: #0000BB">$xsl</span><span style="color: #DD0000">"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$arguments</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(empty(</span><span style="color: #0000BB">$html</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;die(</span><span style="color: #DD0000">'XSLT&nbsp;processing&nbsp;error:&nbsp;'</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">xslt_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">xslt_free</span><span style="color: #007700">(</span><span style="color: #0000BB">$xsltproc</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$html</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.xslt-create-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.xslt-free.html" class="function" rel="rdfs-seeAlso">xslt_free()</a> - Free XSLT processor</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-backend-version.html">xslt_backend_version</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.xslt-errno.html">xslt_errno</a></div>
 <div class="up"><a href="ref.xslt.html">XSLT (PHP 4) 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
